<template>
  <div class="app-container">
    <el-form :model="config" ref="form" size="small"  :rules="rules" :inline="true" label-width="120px">
        <el-row>
            <el-form-item label="用户协议" prop="user">
            <editor v-model="form.user" :height="192"/>
            </el-form-item>
        </el-row>
        <el-row>
            <el-form-item label="接单协议" prop="taking">
            <editor v-model="form.taking" :height="192"/>
            </el-form-item>
        </el-row>
        <el-row>
            <el-form-item label="保证金说明" prop="bond_summary">
               <editor v-model="form.bond_summary" :height="192"/>
            </el-form-item>
        </el-row>
        <el-row>
            <el-form-item label="提现规则" prop="rule">
            <editor v-model="form.rule" :height="192"/>
            </el-form-item>
        </el-row>
        <el-form-item>
        <el-button type="primary" size="medium"  v-hasPermi="['param:index:edit']" @click="updateKey">修改</el-button>
      </el-form-item>
    </el-form>

  </div>
</template>

<script setup name="param">
 import { getConfigByKeys, updateByKeys } from "@/api/main/common";
    const { proxy } = getCurrentInstance();
    const data = reactive({
    form: {},
    rules: {
                    user: [
                { required: true, message: "状态不能为空", trigger: "change" }
                ],
                 rule: [
                { required: true, message: "状态不能为空", trigger: "change" }
                ]
    }
  });
  const { form, rules } = toRefs(data);

  function getKey(){
    getConfigByKeys("user,rule,bond_summary,taking").then(res=>{
        form.value=res.data
    })
  }
  
  function updateKey(){
    updateByKeys(form.value).then(res=>{
        proxy.$modal.msgSuccess("修改成功");
    })
  }

  getKey()
</script>
